it means a mapper that defines a way of loading instances of a class from a particular selectable or table - but says nothing about how it should be persisted, or how its attributes should be defined.
It is generally only useful as an alternative target in a relationship() that would like to load the target object from an alternate subquery. If I eventually come up with a simpler way to achieve that result, it would be gone entirely as a feature. On Jul 5, 2010, at 5:49 AM, sandro dentella wrote: > > Please, can anybody tell me what's the meaning of 'non_primary' arg of > mapper function. > > I probably misunderstood it but I'd like to know what it is meant for. > > thanks > sandro > > > > On Thu, Jul 01, 2010 at 10:41:44AM -0700, sandro dentella 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 that 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 what's the real meaning of primary_key? >> >> >> thanks >> >> sandro >> *:-) > > -- > Sandro Dentella *:-) > http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy > > -- > 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. > -- 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.