On Aug 22, 2006, at 2:05 PM, Alan Franzoni wrote:

OK, got that. Then, what about my idea of 'encapsulating' the fk column if
the property is enabled? Or at least adding an option for doing that
(something like 'hide_column=True' when declaring the property)? This
should be pretty straighforward (at least if the property is added when the
mapper is created, I recognize some problems may arise if a property is
added by add_property() function and we'd want that sort of behaviour).


oh i see, you mean that saying x.user_id=10 would raise an error regardless.  or even better, it creates the attributes as the standard python "_classname__attrname"...thats a little more interesting.   also is not very difficult to implement, it just involves adding an option to ColumnProperty in sqlalchemy/orm/properties.py.   I dont think id want that as the default though....theres no issue with users manipulating the foreign key attributes on objects, its just that the settings dont interact with the object model in real time.  do you think many people would be interested in that feature ?  since it doesnt really give you any more capabilities, it just adds a slight amount of privacy to the model's internals.


BTW, if it adds a lot of overhead I recognize you're perfectly right at not
employing it as a default behaviour. I'll take a deeper look at SA's
sources and try to code an extension.

you can try that too.  using the "private naming convention" idea wouldnt add any overhead though (it might introduce some bugs but nothing serious).


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to