On Fri, Jun 22, 2012 at 07:34:50AM +0100, Hans Georg Schaathun <georg...@schaathun.net> wrote: > On Fri, Jun 22, 2012 at 12:56:05AM +0400, Oleg Broytman wrote: > > I think there have to be a way to generate id's for a complex VIEW > > by, e.g., combining id's into a string with a delimiter; SQLObject > > supports string id. Or calculating a hash value of that combined id and > > using the hash as the id. > > I remember to have seen an example on how to do that, but I could not > find it when I tried. There are some caveats to using string ID's, > according to the doc's, are they only relevant when creating records > and not when reading them? > > When using ViewSQLObject, is something like this supposed to work? > class sqlmeta: > idName = str(table1.q.id) + ":" + str(table2.q.id) > Or am I totally off track?
Not completely. Right way of thinking, wrong direction. SQLObject doesn't "unparse" python expressions and converts them to SQL expressions. To do this there is sqlbuilder.SQLExpression. Unfortunately, in this particular case SQLExpression is not of any help (though IWBN if someone patches SQLObject to allow such a thing) - currently SQLObject expects idName to be a string. What I tried to suggest was: combine id's into one string on the server side, perhaps in the definition of a VIEW. SELECT CAST(t1.id as TEXT) + ':' + CAST(t2.id as TEXT) AS id, ... Oleg. -- Oleg Broytman http://phdru.name/ p...@phdru.name Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss