On Fri, 27 Apr 2007 14:19:57 -0400, Mike Orr <[EMAIL PROTECTED]> wrote:

> 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.

you could autoload a table in one metadata, and create a table in another  
metadata (thats used for the application) selectively adding filtered  
columns.

also the sqlalchemy list has moved to google groups.

hth,

kapil

-------------------------------------------------------------------------
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

Reply via email to