Is it possible to make a mapper class that loads & modifies only some fields in a table rather than all the fields, yet still autoloads the fields rather than having hardcoded column types? I've been avoiding the ORM because frequenty I want to iterate every record without loading some large text fields, and to avoid 20-line SELECTS in the log which make debugging less convenient. Yet now I have a data-conversion project and have been charmed at the ability to load an object, modify and flush it, without having to do "SELECT" + "UPDATE ... WHERE".
When I brought this up previously (in a read-only context), somebody suggested mapping a Select rather than a Table. That worked but it led to "select of select" or "select of select of select", which performed considerably worse than building a query dynamically (by calling a function to to create the query and set the field list, and then calling .append_whereclause several times). What I'd like to do is pass a list of column names to the Table constructor and have it autoload those and ignore the others. I couldn't find an argument for this. Alternatively I could autoload the table and then delete the undesired columns via a list comprehension, but it looks like that would involve modifying private attributes with possibly unintended consequences. A few other questions and comments: - Is there a supported way to add/remove fields from a query after it's been constructed? - The .scalar() method of query results is incredibly useful but poorly documented. It's shown in a few examples in the manual but not explained. I added ticket #549 for it, and just now saw zzzeek's comment requesting wording explaining both that and the entire ResultProxy class, so I'll work on that. -- Mike Orr <[EMAIL PROTECTED]> ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users