Better control on which columns are mapped as properties
Issue #696
resolved
(original reporter: ged) We'd like a way to map only a subset of a selectable columns into mapper properties.
Suggested API/syntaxes for this were:
See this thread:
http://groups.google.com/group/sqlalchemy/browse_frm/thread/80e35e5ce61ffc3d
Comments (6)
-
repo owner -
- changed status to resolved
cd2176d48d3996dabbc44205ff7cee344b30248f adds include_properties and exclude_properties
May need expansion for inherits= mapper situations where there is no python inheritence relationship between the mapped classes.
-
repo owner - changed status to open
- removed status
inherits case should be fine, inheriting mappers require python class inheritance be in place.
two little niggles:
- the feature will not work properly if "column_prefix" is specified to the mapper (a column_prefix such as "_" indicates that the mapped property names should be prefixed). the include/exclude should be against column.key, not the prefixed key. one of the mappers in the unit test should have a "column_prefix" setting to test.
- the unit test has a lot of m.compile() happening there, you can just call compile() on one mapper which always compiles everything, or just "compile_mappers()".
-
Okie dokie. f8ebf35deb4864826b6bc1789223e2a42e6edf96
-
- changed status to resolved
-
repo owner - removed milestone
Removing milestone: 0.4.0 (automated comment)
- Log in to comment
seems like include_props/exclude_props were what we decided. the loop for adding in columns is at mapper.py line 572 currently - a couple of lines there are all that's needed.