Hey,

a workaround i've used is is to manually set primary key to being a
composite of all columns if the table has no actual primary key.  however,
this will mean that sqlalch ignores any duplicate rows, which you may not
want.

hp.

On Thu, Jul 1, 2010 at 7:41 PM, sandro dentella <san...@e-den.it> wrote:

> Hi,
>
> I'm trying to use non_primary arg of function 'mapper'.
>
>
> Currently I have a GUI widget to browse/edit tables that is based on
> introspection of the mapper.
>
> My goal would be to reuse all the machinary of table browsing even
> when browsing tables tat where built w/o primary key.
>
> I'm ready to understand that I can't use persistence but I thought
> that flagging as a non primary mapper I could assemble a mapper even
> from a table missing a primary_key, that's what I thought was the
> meaning of: "Construct a Mapper that will define only the selection of
> instances, not their persistence."
>
> What I get is:
>
> ipdb> mapper(X, table, non_primary=True)
> *** ArgumentError: Mapper Mapper|lavori_class|lavori|non-primary could
> not assemble any primary key columns for mapped table 'lavori'
>
> So wht's the real meaning of primary_key?
>
>
> thanks
>
> sandro
> *:-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com<sqlalchemy%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>


-- 
------------------------------
Harry J.W. Percival
------------------------------
Italy Mobile: +39 389 095 8959
UK Mobile:  +44 (0) 78877 02511 (may be turned off)
Skype:         harry.percival
Email:          harry.perci...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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