On Monday 17 September 2007 15:28:00 Kevin Cole wrote:
> One thing I've learned is that SQLAlchemy wants primary keys for the
> entities that reference the views. Since many of my views don't have any
> single unique column, and I'm not particularly seeing the need (in this
> case), is it reasonable to just [CREATE SEQUENCE whatever CYCLE] in
> PostgreSQL and then in the view, issue a [SELECT nextval('whatever'), ...]
> to get a unique value that can satisfy SQLAlchemy's need?
I wouldn't go that route. I prefer concatenating the PKs of the records in a
new column to form the primary key. I usually have, on these cases, an
idType of 'str'. Another alternative is retrieving one of the PKs alone is
it isn't repeated.
The bigger problem with using the sequence is if you want to operate on one of
the records returned by your view: you won't be able to find out which record
you should deal with.
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---