Bryan wrote:
>
> I want to abstract some ugly reporting SQL strings into a read-only
> object model.  I have created an empty class, and then I map it to a
> select object that pulls some statistical information from the DB.
> The mapper is complaining that it can't assemble a primary key.  I am
> only using this object as a simplified way of querying the database,
> and will never want to persist the object.  The object is read-only.
> Is there a way to tell sqlalchemy not to worry about persisting this
> class?

the primary key is for more than just persistence.  Pick whatever columns
on your select object you think are suitable, then configure them on the
mapper using the "primary_key" option:

mapper(MyClass, myselect, primary_key=[myselect.c.foo, myselect.c.bar])


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