On Thu, Jun 21, 2012 at 10:15:03AM +0200, Petr Jakeš wrote:
> Hi,
> I am not sure if following is what are you looking for, but in my case, I
> have a view defined manually on the SQL server side.

I suppose I was looking for the ViewSQLObject class as a way to achieve
the same thing with a lesser need to learn more SQL ...

Anyway, thanks for the code example.  I reckon I can figure out how
it works by reading up on hash joins.  

> in the SQLObject I am working with the VIEW like it with an ordinary table,
> see my code below:
> 
> =========== SQLObject part ===============
> class HashView(SQLObject):
>     class sqlmeta:
>         fromDatabase = True
>         columnList = True
> =========================================
> 
> ================== server part =====================================
> 
> CREATE VIEW HASH_VIEW (ID, OSOBY_ID, JMENO_1, JMENO_2, IBUTTON, MD5_HASH,
> T_STAMP)
> AS
> select m.id, deriv.osoby_id, deriv.jmeno_1, deriv.jmeno_2, deriv.ibutton,
> m.md5_hash, deriv.t_stamp
> from hash m
> join
>     (
>     select m1.osoby_id, p.jmeno_1, p.jmeno_2, p.ibutton, max(m1.t_stamp)
>     from hash m1
>        join osoby p on (p.id = m1.osoby_id)
>     group by 1,2,3,4)
>         as deriv (osoby_id, jmeno_1, jmeno_2, ibutton, t_stamp)  on
> m.osoby_id = deriv.osoby_id
> 
> where deriv.t_stamp = m.t_stamp;
> 
> GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
>  ON HASH_VIEW TO  SYSDBA WITH GRANT OPTION;
> =====================================================================
> 
> HTH
> 
> Petr

-- 
:-- Hans Georg

------------------------------------------------------------------------------
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

Reply via email to